home *** CD-ROM | disk | FTP | other *** search
/ The World's Largest Collection of Windows Software / The World's Largest Collection of Windows Software - Disc 1.iso / connect / _j2 / wvnsc926 / rcs / wvauth.c < prev    next >
C/C++ Source or Header  |  1994-09-21  |  5KB  |  222 lines

  1. head     1.4;
  2. branch   ;
  3. access   ;
  4. symbols  V80:1.1 V76d:1.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.4
  10. date     94.09.16.00.57.44;  author jcooper;  state Exp;
  11. branches ;
  12. next     1.3;
  13.  
  14. 1.3
  15. date     94.08.24.18.40.15;  author mrr;  state Exp;
  16. branches ;
  17. next     1.2;
  18.  
  19. 1.2
  20. date     93.12.08.01.28.38;  author rushing;  state Exp;
  21. branches ;
  22. next     1.1;
  23.  
  24. 1.1
  25. date     93.02.16.20.53.50;  author rushing;  state Exp;
  26. branches ;
  27. next     ;
  28.  
  29.  
  30. desc
  31. @winvn version 0.76 placed into RCS
  32. @
  33.  
  34.  
  35. 1.4
  36. log
  37. @rearranged headers to allow precompiled headers
  38. @
  39. text
  40. @
  41. /*
  42.  *
  43.  * $Id: wvauth.c 1.3 1994/08/24 18:40:15 mrr Exp $
  44.  * $Log: wvauth.c $
  45.  * Revision 1.3  1994/08/24  18:40:15  mrr
  46.  * authorization enables post/mail
  47.  *
  48.  * Revision 1.2  1993/12/08  01:28:38  rushing
  49.  * new version box and cr lf consistency
  50.  *
  51.  * Revision 1.1  1993/02/16  20:53:50  rushing
  52.  * Initial revision
  53.  *
  54.  *
  55.  */
  56.  
  57. /*--- WVAUTH.C -- Routines for authentication in WinVN
  58.  *
  59.  *   Mark Riordan  14 August 1990
  60.  */
  61.  
  62. #include <windows.h>
  63. #include <windowsx.h>
  64. #include "wvglob.h"
  65. #include "winvn.h"
  66. #pragma hdrstop
  67.  
  68. unsigned int newdes_buf (unsigned char *buf, unsigned int block_length);
  69. void newdes_block (unsigned char *block);
  70. void newdes_set_key_encipher (unsigned char *key);
  71. void newdes_set_key_decipher (unsigned char *key);
  72.  
  73. int uuencode (unsigned char *bufin, unsigned int nbytes,
  74.          unsigned char *bufcoded);
  75. int uudecode (unsigned char *bufcoded, unsigned char *bufplain);
  76.  
  77.  
  78. static unsigned char key[]=
  79. {
  80.   0x58, 0x20, 0x41, 0xaf, 0xb4, 0xce, 0x58, 0xbb, 0xb0,
  81.   0x1a, 0xaf, 0x6e, 0x00, 0x5e, 0x60
  82. };
  83.  
  84.  
  85. /*--- function AuthenticatePosting --------------------------------
  86.  *
  87.  *   Determine whether the user has sent valid authentication
  88.  *   information to the host.
  89.  *
  90.  *    Entry    Authenticated  is TRUE if we're already authorized.
  91.  *             AuthReq        is TRUE if we need authorization.
  92.  *
  93.  *    Exit     Returns TRUE if we are authorized, else FALSE.
  94.  *                                                             
  95.  *    This routine is largely unimplemented.
  96.  *    Intended
  97.  *    Method   If we're already authorized, just return TRUE.
  98.  *             Otherwise, make sure the comm channel to the server
  99.  *             isn't busy.  If it is, put up a message to that
  100.  *             effect and quit.
  101.  *             If not busy, get authorization information from the
  102.  *             user and present it to the server (in encoded form).
  103.  *             Wait until the server responds or until the Abort
  104.  *             Protocol flag is set (by the user via a menu).
  105.  *             If authorized, return TRUE, else put up a
  106.  *             message to the user and return FALSE.
  107.  */
  108. BOOL
  109. AuthenticatePosting (AuthReq)
  110. BOOL AuthReq;
  111. {  
  112.    BOOL whetherOK=FALSE;
  113.                       
  114.    if(AuthReq && !Authenticated) {
  115.       MessageBox(hWndConf,
  116.       "Sorry, you must identify yourself to the news server \
  117. before sending.  Choose the Config/Configure Comm... menu option \
  118. and enter your username and password.  \
  119. Then Choose Network/Disconnect and Network/Connect.",
  120. "No permission",MB_OK);
  121.    } else {
  122.       whetherOK = TRUE;
  123.    }
  124.    
  125.    return(whetherOK);
  126. }
  127.  
  128. /*-- function WinVnAuthDlg ---------------------------------------
  129.  *
  130.  *  Window function to handle Save Article dialog box.
  131.  */
  132.  
  133. BOOL FAR PASCAL 
  134. WinVnAuthDlg (hDlg, iMessage, wParam, lParam)
  135.      HWND hDlg;
  136.      unsigned iMessage;
  137.      WORD wParam;
  138.      LONG lParam;
  139. {
  140.    return (TRUE);
  141.  
  142. }
  143.    
  144. /*--- function AddAuthHeader --------------------------------
  145.  *
  146.  *  Add an X-Authenticated-User: line to the beginning
  147.  *  of an edit control.
  148.  *
  149.  *  Entry:  hWndEdit    is the handle of an edit control.
  150.  *          AuthenticatedName    is the name of the user; it's been
  151.  *                               checked by the server.
  152.  */    
  153. void
  154. AddAuthHeader(hWndEdit)
  155. HWND hWndEdit;
  156. {
  157.    char line[MAXHEADERLINE];
  158.    
  159.    sprintf(line,"X-Authenticated-User: %s\r\n",AuthenticatedName);
  160.    SendMessage(hWndEdit,EM_SETSEL,1,MAKELPARAM(0,0));
  161.    SendMessage(hWndEdit,EM_REPLACESEL,0, (LPARAM) ((LPCSTR) line));
  162.    
  163. } @
  164.  
  165.  
  166. 1.3
  167. log
  168. @authorization enables post/mail
  169. @
  170. text
  171. @d4 1
  172. a4 1
  173.  * $Id: wvauth.c 1.2 1993/12/08 01:28:38 rushing Exp $
  174. d6 3
  175. d24 1
  176. d26 2
  177. @
  178.  
  179.  
  180. 1.2
  181. log
  182. @new version box and cr lf consistency
  183. @
  184. text
  185. @d4 1
  186. a4 1
  187.  * $Id: wvauth.c 1.1 1993/02/16 20:53:50 rushing Exp rushing $
  188. d6 3
  189. d21 1
  190. d29 1
  191. a29 1
  192.           unsigned char *bufcoded);
  193. d45 2
  194. a46 1
  195.  *    Entry    Authorized  is TRUE if we're already authorized.
  196. d49 3
  197. a51 1
  198.  *
  199. d64 17
  200. a80 3
  201. AuthenticatePosting ()
  202. {
  203.      return(TRUE);
  204. d95 1
  205. a95 1
  206.     return (TRUE);
  207. d98 21
  208. @
  209.  
  210.  
  211. 1.1
  212. log
  213. @Initial revision
  214. @
  215. text
  216. @d1 1
  217. d4 5
  218. a8 2
  219.  * $Id$
  220.  * $Log$
  221. @
  222.